package finalproject.model.player;

/**
 * Represents the player Energy
 * Energy is used to determine if the player can follow a class or pass an exam
 * @author Nicolas Bighetti
 *
 */
public class Energy {

	/**
	 * The default energy one will have
	 */
	private static final int DEFAULT_ENERGY = 10;
	private static final int MAX_ENERGY = 20;
	
	/**
	 * The player current energy
	 */
	private int energy;
	
	/**
	 * Energy default constructor
	 */
	public Energy()
	{
		energy = DEFAULT_ENERGY;
	}
	
	/**
	 * Energy constructor
	 * @param energy the base energy level
	 */
	public Energy(int energy)
	{
		this.energy = energy;
	}

	/**
	 * @return the energy
	 */
	public int getEnergy() {
		return energy;
	}

	/**
	 * @param energy the energy to set
	 */
	public void setEnergy(int energy) {
		if(energy>=MAX_ENERGY)
			this.energy = MAX_ENERGY;
		else if(energy < 0)
			this.energy = 0;
		else
			this.energy = energy;
	}
	
	public boolean isMax(){		
		if(energy==MAX_ENERGY)
			return true;
		else
			return false;		
	}
	
	public int getMaxEnergy()
	{
		return MAX_ENERGY;
	}
	
	public String toString(){
		return "" + energy;
	}
	
}
